<?php
/**
 * Zhub - A PHP Framework For API Developer
 *
 * This file is part of the Zhub package.
 *
 * (c) YiLong Fan <fantiq@163.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author fanyilong <fantiq@163.com>
 * @copyright 2017 fanyilong. All rights reserved.
 * @package Zhub
 * @date 18-3-5
 */

namespace Zhub\HttpMessage\Headers;


use Zhub\DataStruct\Maps\StringMap;

class ResponseHeader extends HeaderStruct
{
    public static function initialize(): array
    {
        return [
            self::HEADER => function () {return StringMap::class;},
            self::COOKIE => function () {return CookieMap::class;},
        ];
    }

    public function getCookieMap():CookieMap
    {
        return $this->get(self::COOKIE);
    }

    public function setCookieMap(CookieMap $map = null)
    {
        if ($map == null) return null;
        $this->set(self::COOKIE, $map);
    }

    public function toString(): string
    {
        return parent::toString() . "\n" .
            $this->getCookieMap()->toString();
    }
}
